<?php


namespace App\Service;


use App\Entity\DbLog;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;

class Dlog extends ServiceEntityRepository
{

    public function __construct(ManagerRegistry $registry){
        parent::__construct($registry,DbLog::class);
    }
    public function add($data)
    {
        $log = new DbLog();
        $log->setData(json_encode($data))
            ->setCreateAt(new \DateTime());
        $this->_em->persist($log);
        $this->_em->flush();
    }
}